import React from "react";
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
import Redirect from "./components/Redirect";

import Home from "./views/home/index";
import Target from "./views/target/index";
import My from "./views/my/index";
import Login from "./views/login/index";
import Love from "./views/love/index";
import Browse from "./views/browse/index";
import Demo from "./views/demo/index";
import Order from "./views/order/index";
import OrderList from "./views/order/children/List";
import OrderDetail from "./views/order/children/Detail";
import Find from "./views/find";

function App() {
  return (
    <div className="app">
      <Router>
        <Routes>
          {/* 路由小写, 组件大写 */}
          <Route path="/home" element={<Home />} />
          <Route path="/target" element={<Target />} />
          <Route path="/my" element={<My />} />
          <Route path="/login" element={<Login />} />
          <Route path="/love" element={<Love />} />
          <Route path="/browse" element={<Browse />} />
          <Route path="/find" element={<Find />} />
          <Route path="/demo" element={<Demo />} />
          <Route path="/order" element={<Order />}>
            {/* 子路由配置 */}
            <Route path="list" element={<OrderList/>}/>  
            <Route path="detail" element={<OrderDetail/>}/>  
          </Route>
          <Route path="/" element={<Redirect to="/home" />} />
        </Routes>
      </Router>
    </div>
  );
}

export default App;
